package com.looso.sfolder.data;

import java.io.Serializable;



public class FileData implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -4169605388687290759L;
	private String mId = null;
	private String mName = null;
	private int mCount = 0;
	private String mPath = null;
	private String mKey = null;
	
	private int mCurrentPageIndex = 1;
	
	public FileData(){
		
	}
	public FileData(String name,int count,String path,String key){
		this.mName = name;
		this.mCount = count;
		this.mPath = path;
		this.mKey = key;
	}
	
	public String getName(){
		return this.mName;
	}
	public int getCount(){
		return this.mCount;
	}
	public String getPath(){
		return this.mPath;
	}
	public String getKey(){
		return this.mKey;
	}
	public String getId(){
		return this.mId;
	}
	
	public void setName(String name){
		this.mName = name;
	}
	public void setCount(int count){
		this.mCount = count;
	}
	public void setPath(String path){
		this.mPath = path;
	}
	public void setKey(String key){
		this.mKey = key;
	}
	public void setId(String id){
		this.mId = id;
	}
	
	
	//control
	public int getCurrentPageIndex(){
		return mCurrentPageIndex;
	}
	public int getPageCount(){
		return mCount;
	}
	public String getCurrentPageUrl(){
		if(mPath!=null && mCount>0){
			return UserInfo.getInstance().getHost()+mPath+mCurrentPageIndex+".jpg";
		}else{
			return null;
		}
	}
	
	public String goFirstPage(){
		if(mPath!=null && mCount>0){
			mCurrentPageIndex = 1;
			return UserInfo.getInstance().getHost()+mPath+mCurrentPageIndex+".jpg";
		}else{
			return null;
		}
	}
	public String goPrevPage(){
		if(mPath!=null && mCount>0){
			if(mCurrentPageIndex>1){
				mCurrentPageIndex -- ;				
			}
			return UserInfo.getInstance().getHost()+mPath+mCurrentPageIndex+".jpg";
		}else{
			return null;
		}
	}
	public String goNextPage(){
		if(mPath!=null && mCount>0){
			if(mCurrentPageIndex < mCount){
				mCurrentPageIndex ++;
			}
			return UserInfo.getInstance().getHost()+mPath+mCurrentPageIndex+".jpg";
		}else{
			return null;
		}
	}
	public String goLastPage(){
		if(mPath!=null && mCount>0){
			mCurrentPageIndex = mCount;
			return UserInfo.getInstance().getHost()+mPath+mCurrentPageIndex+".jpg";
		}else{
			return null;
		}
	}
	
	
}
